package com.platform.common.result;


import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.util.List;

@Data
public class Content<T> {

    private List<T> list;

    private long total;

    private long size;

    private long page;

    public static <T> Content<T> init(IPage<T> data) {
        Content<T> content = new Content<>();
        content.setList(data.getRecords());
        content.setTotal(data.getTotal());
        content.setSize(data.getSize());
        content.setPage(data.getCurrent());
        return content;
    }

}
